package java69.work720;

import java.util.Scanner;

public class Book {
    protected String title;
    protected int pageNum;

    public Book() {
        this.pageNum = 200;
    }

    public Book(String title, int pageNum) {
        this.title = title;
        this.pageNum = pageNum;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        if (pageNum<200){
            System.out.println("页数不能少于200");
        }else {
            this.pageNum = pageNum;
        }
    }

    public void detail(){
        Scanner sc = new Scanner(System.in);Book book = new Book();
        System.out.println("请输入书名：");
         setTitle(sc.next());
        System.out.println("请输入页数：");
        setPageNum(sc.nextInt());
        System.out.println("书名："+getTitle()+"，页数："+getPageNum());
    }

    public static void main(String[] args) {
        Book book = new Book();
        book.detail();
    }
}
